<?php
/*
 * filter_var
 */
$str = '51ab';
echo filter_var($str, FILTER_VALIDATE_INT) ? 'is valid' : 'is not valid';

echo "<br>";
$str = '257';
echo filter_var($str, 257) ? 'is valid' : 'is not valid';

echo "<br>";
var_dump(filter_list());
echo filter_id("int");
echo filter_id("boolean");
echo filter_id("string");

echo "<br>";
$email = '<script>alert("test");</sript>';
echo filter_var($email, FILTER_SANITIZE_EMAIL);

echo "<br>";
$options = array(
	'options' => array(
		'max_range' => 50
	)
);
$str = '51';
echo filter_var($str, FILTER_VALIDATE_INT, $options) ? 'is valid' : 'is not valid'; 

echo "<br>";
$mystr = "abc@caixw.com";
echo strtr($mystr, "ab", "23");
echo "<br>";
echo str_replace("abc", "2", $mystr);
?>